package com.dy.design_pattern_study.visitor_pattern.dome3.impl_visitor;

import com.dy.design_pattern_study.visitor_pattern.dome3.Visitor;
import com.dy.design_pattern_study.visitor_pattern.dome3.impl_element.ConcreteElementA;
import com.dy.design_pattern_study.visitor_pattern.dome3.impl_element.ConcreteElementB;

/**
 * @CreateBy zhangdingyi
 * @Date 2023-04-25
 * @Content 具体的访问者
 * 具体访问者，实现每个由Visitor声明的操作。
 * 每个操作实现算法的一部分，而该算法片断乃是对应于结构中对象的类
 */
public class ConcreteVisitor1 extends Visitor {
    @Override
    public void visitConcreteElementA(ConcreteElementA concreteElementA) {
        System.out.println("-------------start-------------------");
        System.out.println("访问者：" + getClass().getSimpleName());
        System.out.println("被访问者：" + concreteElementA.getClass().getSimpleName());
        System.out.println("--------------end------------------");
    }

    @Override
    public void visitConcreteElementB(ConcreteElementB concreteElementB) {
        System.out.println("-----------------start---------------");
        System.out.println("访问者：" + getClass().getSimpleName());
        System.out.println("被访问者：" + concreteElementB.getClass().getSimpleName());
        System.out.println("------------------end--------------");

    }
}
